Convert a Tuple to a DictionaryΒΆ

dict((y, x) for x, y in T)

Convert a Tuple to a Dictionary.
# create a tuple
T = (
      (2, 'w'),
      (3, 'r'),
    )

print(dict((y, x) for x, y in T))              # {'r': 3, 'w': 2}